import {
  post,
  ajaxSetup,
} from "jquery"
import * as interfaces from './Interfaces.json'
import Tracker from './Tracker.js';
import Agent from './Agent.js';

function csrfSafeMethod(method) {
  // these HTTP methods do not require CSRF protection
  return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}

// 添加csrf 验证
// 添加日志
ajaxSetup({
  beforeSend: function (xhr, settings) {
    if (process.env.NODE_ENV === 'production') {
      const host = 'cn-qingdao.log.aliyuncs.com';
      const project = 'htetest1';
      const logstore = 'htenewweblog';
      let log = new Tracker(host, project, logstore);
      if (settings.data) {
        log.push('_params_', settings.data);
        let data = settings.data.split('&')
        for (let v in data) {
          let to = data[v].split('=');
          if (to[0].replace(/\s+/g, "") === "uid") {
            log.push('_uid_', to[1]);
          }
          if (to[0].replace(/\s+/g, "") === "cid") {
            log.push('_cid_', to[1]);
          }
          if (to[0].replace(/\s+/g, "") === "ips") {
            log.push('_ip_', to[1]);
          }
        }
      }
      log.push('_method_', settings.url);
      log.push('_type_', settings.type);
      log.push('_error_', xhr.responseJSON && xhr.responseJSON.error);
      log.push('_topic_', 'htewebhome');
      new Agent(log);
      log.logger()
    }

    if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
      let arr = document.cookie.split(';')
      for (let v in arr) {
        let to = arr[v].split('=');
        if (to[0].replace(/\s+/g, "") === "csrfToken") {
          xhr.setRequestHeader('x-csrf-token', to[1].replace(/\s+/g, ""));
        }
      }
    }
  },
});
export const asynclogin = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.login, data).then(response => {
      if (response.error == 0) {
        window.userid = response.data.userid
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncloginphonenum = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.loginphonenum, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function () {

      reject('服务器开小差了')
    })
  })
}

export const session = function () {
  return new Promise((resolve, reject) => {
    post(interfaces.online).then(response => {
      if (response.error == 0) {
        window.userid = response.data.userid
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const allUser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getAllUser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const getallcourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.AllCourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// export const packagekey = function (data) {
//   return new Promise((resolve, reject) => {
//     post(interfaces,data).then(response => {
//       if (response.error == 0) {
//         resolve(response.packagekey)
//       } else {
//         reject(response.msg)
//       }
//     }).catch(function (error) {
//       console.log(error);
//       reject('服务器开小差了')
//     })
//   })
// }


// 通过cid 获取course 和courseliseeion 的方法
export const asyncgetCourseAndLessionsByCourseID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getCourseAndLessionsByCourseID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取上传权限
export const asyncuploadAccess = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.uploadAccess, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 上传course
export const asyncuploadCourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.uploadCourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 上传course
export const asyncupdateCourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateCourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除course
export const asyncdeleteCourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteCourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加lession
export const asyncuploadLession = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.uploadLession, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 更新lession
export const asyncupdateLession = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateLession, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 删除lession
export const asyncdeleteLession = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteLession, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加代理商
export const asyncnewAgent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.newAgent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 添加package
export const asyncnewPackege = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.newPackege, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加AgentKey
export const asyncaddAgentKey = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addAgentKey, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加AgentKey
export const asyncaddPackegeKey = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addPackegeKey, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加addPackege
export const asyncaddPackege = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addPackege, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取package
export const asyncgetAllPackege = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getAllPackege, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取package
export const asyncgetCourseByPackegeID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getCourseByPackegeID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//
export const asyncgetUserByUser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getUserByUser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//
export const asyncgetUserCourseInfo = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getUserCourseInfo, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取代理商课程包
export const asyncgetAgentCoursePak = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getAgentCoursePak, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除代理商课程包
export const asyncdeleteAgebtKeyByID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteAgebtKeyByID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//  删除课程包的课程
export const asyncdeletePackegeByID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deletePackegeByID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除课程包
export const asyncdeletePackegeKeyByID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deletePackegeKeyByID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改用户
export const asyncupdateUser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateUser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 删除用户
export const asyncdeleteUserByID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteUserByID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改课程包
export const asyncupdatePackegeKey = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatePackegeKey, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}




export const asyncvideoQuestion = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.videoQuestion, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 添加视频问题
export const asyncuploadQuestion = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.uploadQuestion, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 修改视屏问题
export const asyncupdateQuestion = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateQuestion, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除视频问题

export const asyncdeleteQuestion = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteQuestion, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员获取视频
export const asyncgetVideoPermissionByID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getVideoPermissionByID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 提交答案 
export const asynccheckQuestion = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.checkQuestion, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建学生

export const asyncnewstudent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.newStudent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取视频信息

export const asyncgetvideoInfo = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.videoInfo, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 通过course id 获取 lession
export const asyncgetLessionByCourseid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getLessionByCourseid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取用户课程

export const asyncgetktUser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getCourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取推荐课程

export const asyncgetTuijian = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.AllCourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取课堂信息
export const asyncgetktById = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.CourseInfo, data).then(response => {
      if (response.error == 0) {
        resolve(response.courses)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncupdate = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.update, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 支付宝接口
export const asyncpay = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.pay, data, "text").then(response => {
      resolve(response.data)
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 重置密码

export const asyncchangePassword = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.changePassword, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncUserCourseInfo = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.UserCourseInfo, data).then(response => {
      if (response.error == 0) {

        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log("11112121212", error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetLessionByCourseidAndNum = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getLessionByCourseidAndNum, data).then(response => {
      if (response.error == 0) {

        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 刷新用户学到第几节
export const asynclearn = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.learn, data).then(response => {
      if (response.error == 0) {

        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取支付宝支付接口
export const asynpay = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.pay, data).then(response => {

      resolve(response.data)
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加收藏
export const asynaddCollection = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addCollection, data).then(response => {
      if (response.error == 0) {

        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 用户注册
export const asyncregist = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.regist, data).then(response => {
      if (response.error == 0) {

        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取子用户
export const asyncgetChildren = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getChildren, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取课程包
export const asyncgetInvite = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getInvite, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 审核子用户
export const asynccheckUser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.checkUser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetCourseFile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getCourseFile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取yzm
export const asyncfind_getCode = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.find_getCode, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 检查yzm
export const asyncfind_checkCode = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.find_checkCode, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 修改密码
export const asyncfind_findPassword = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.find_findPassword, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 注册获取yzm
export const asyncregist_getCode = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.regist_getCode, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}




// 获取微信支付
export const asyncWXpay = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.WXpay, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 站内信
// 创建消息
export const asyncnewMessage = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.newMessage, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询收到消息
export const asyncreceivedMessage = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.receivedMessage, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询发送消息
export const asyncsentMessage = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.sentMessage, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 标记消息已读
export const asyncreadMessage = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.readMessage, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取视频列表
export const asyncGetVideoList = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.GetVideoList, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改视频
export const asyncupdateVideoInfo = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateVideoInfo, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除视频
export const asyncdeleteVideo = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteVideo, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 通过lid获取视频信息

export const asyncgetVideoIDByLessionID = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getVideoIDByLessionID, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncgetlessions = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getlessions, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// wx获取验证码
export const asyncgetLoginQRCode = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getLoginQRCode, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// wx绑定
export const asyncgetBindQRCode = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getBindQRCode, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// // wxWXBindPhone
// export const asyncWXBindPhone = function (data) {
//   return new Promise((resolve, reject) => {
//     post(interfaces.WXBindPhone).then(response => {
//       if (response.error == 0) {
//         resolve(response.data)
//       } else {
//         reject(response.msg)
//       }
//     }).catch(function (error) {
//       console.log(error);
//       reject('服务器开小差了')
//     })
//   })
// }

// // wxbindWXBindUser
// export const asyncWXBindUser = function (data) {
//   return new Promise((resolve, reject) => {
//     post(interfaces.WXBindUser).then(response => {
//       if (response.error == 0) {
//         resolve(response.data)
//       } else {
//         reject(response.msg)
//       }
//     }).catch(function (error) {
//       console.log(error);
//       reject('服务器开小差了')
//     })
//   })
// }

// WXAuthorize
export const asyncWXAuthorize = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.WXAuthorize).then(response => {
      if (response.error == 0) {
        resolve(response.data, data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 免费课程
export const asyncForfeepay = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.Forfeepay, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询用户积分
export const asyncgetUserAllPoint = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getUserAllPoint, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncgetuserTypePoint = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getUserTypePoint, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员增删改查 角色
export const asyncaddRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员增删改查 角色
export const asynccancelRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.cancelRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员增删改查 角色
export const asyncupdateRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员增删改查 角色
export const asyncselectRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员增删改查 角色
export const asyncaddUserRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addUserRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 管理员增删改查 角色
export const asyncchangeUserRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.changeUserRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncdeleteUserRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteUserRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncgetUserRole = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getUserRole, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncaddRoleAuth = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addRoleAuth, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncdeleteRoleAuth = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteRoleAuth, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncgetRoleAuth = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getRoleAuth, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询某个用户的类别分
export const asyncselectAuth = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectAuth, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 用户添加课程
export const asyncaddUsercouser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addUsercouser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询教师
export const asyncselectTeacher = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectTeacher, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加教师
export const asyncaddTeacher = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addTeacher, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改教师
export const asyncupdateTeacher = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateTeacher, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除教师
export const asyncdeleteTeacher = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteTeacher, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询学生
export const asyncselectStudent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectStudent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加学生
export const asyncaddStudent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addStudent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改学生
export const asyncupdateStudent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateStudent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除学生
export const asyncdeleteStudent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteStudent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询班级
export const asyncselectClazz = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectClazz, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加班级
export const asyncaddClazz = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addClazz, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改班级
export const asyncupdateClazz = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateClazz, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除班级
export const asyncdeleteClazz = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteClazz, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询代理商
export const asyncselectAgent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectAgent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加代理商
export const asyncaddAgent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addAgent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改代理商
export const asyncchangeAgent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.changeAgent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除代理商
export const asyncdeleteAgent = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteAgent, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询管理员
export const asyncselectAdmin = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addUsercouser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加管理员
export const asyncaddAdmin = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addAdmin, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改管理员
export const asyncupdateAdmin = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateAdmin, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除管理员
export const asyncdeleteAdmin = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteAdmin, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除用户课程
export const asyncdeleteUsercourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteUsercourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询用户课程
export const asyncselectUsercourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectUsercourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建课程资料
export const asyncuploadCoursefile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.uploadCoursefile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除课程资料
export const asyncdeleteCoursefile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteCoursefile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改课程资料
export const asyncupdateCoursefile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateCoursefile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询课程资料
export const asyncselectCoursefile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectCoursefile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建视频跳转
export const asyncaddWhitepoint = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addWhitepoint, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除视频调整
export const asyncdeleteWhitepoint = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deleteWhitepoint, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改视频调整
export const asyncupdateWhitepoint = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateWhitepoint, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询视频调整
export const asyncselectWhitepoint = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectWhitepoint, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//查询用户注册的时间段
export const userRegister = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectuserbycrtime, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//课程打包
//显示所有的课程组
export const showbag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.showbag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//向课程组中添加课程
export const addcoursetobag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addcoursetobag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//向课程组中减少课程
export const minuscoursetobag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.minuscoursetobag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//从课程封面点击进去查看内部课程
export const selectcoursebybid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectcoursebybid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//绑定微信
export const bindwechat = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.bindwechat, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
        // resolve(response.data, response.error)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//获取所有课程组
export const getAllCatebag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getAllCatebag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//增加一个课程组
export const addCatebag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addCatebag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//修改一个课程组
export const updataCatebag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updataCatebag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//删除一个课程组
export const delCatebag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delCatebag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取该课程组下的所有课程
export const getCourseByCatabagid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getCourseByCatabagid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取iframelist
export const asyncgetiframelist = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getiframelist, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建iframe
export const asynccreateiframe = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createiframe, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取iframe
export const asyncgetiframebyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getiframebyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取iframe
export const asyncgetiframebycourseid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getiframebycourseid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 获取getCoursecountByCatabagid 数量
export const asyncgetCoursecountByCatabagid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getCoursecountByCatabagid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 通过id获取课程组
export const asyncgetcatebagsbyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getcatebagsbyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


//获取所有课程组类型
export const getAllCatebagtype = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getAllCatebagtype, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//增加一个课程组类型
export const addCatebagtype = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addCatebagtype, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}



//删除一个课程组类型
export const delCatebagtype = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delCatebagtype, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


export const asyncgetuserUsercourse = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getuserUsercourse, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetFileurlall = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getFileurlall, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreateFileurl = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createFileurl, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncdelFileurl = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delFileurl, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


export const wechatsignature = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.wechatsignature, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}



export const asyncgetwechattemp = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getwechattemp, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreatmenu = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.creatmenu, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetmenu = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getmenu, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncdeletemenu = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deletemenu, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}



export const asyncshare = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.share, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncexamineshare = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.examineshare, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncdelwxopid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delwxopid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncforum = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.forum, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreatetopic = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createtopic, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncupdatetopic = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatetopic, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncdelecttopicbyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delecttopicbyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgettopicbyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettopicbyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgettopicbyuser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettopicbyuser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


export const asyncgettopic = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettopic, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetreply = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getreply, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreatereply = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createreply, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynctopiccount = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.topiccount, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


export const asynccreatetopiccollect = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createtopiccollect, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgettopiccollectbyuser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettopiccollectbyuser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetusercollect = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getusercollect, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetuserreply = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getuserreply, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetuserreplyfabulous = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getuserreplyfabulous, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetusertopic = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getusertopic, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreaterepcyfabulous = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createrepcyfabulous, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//创建作品
export const asynccreateshare = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createshare, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//修改作品
export const asyncupdateshare = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateshare, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//通过id删除作品
export const asyncdelectsharebyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delectsharebyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//通过id获取作品
export const asyncgetsharebyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsharebyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//获取自己所有作品
export const asyncgetsharebyuser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsharebyuser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//获取所有已审核的作品
export const asyncgetshare = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getshare, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//给作品点赞或者取消
export const asynccreatesharefabulous = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createsharefabulous, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//通过id获取作品已经点赞
export const asyncgetsharefabulousbyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsharefabulousbyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//创建作品评论
export const asynccreatesharecomment = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createsharecomment, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//通过id删除作品评论
export const asyncdelectsharecommentbyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delectsharecommentbyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//通过id获取评论
export const asyncgetsharecomment = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsharecomment, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//给评论点赞或者取消
export const asynccreatesharecommentfabulous = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createsharecommentfabulous, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//获取评论是否点赞
export const asyncgetsharecommentfabulousbyid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsharecommentfabulousbyid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//上传权限
export const asyncossupload = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.ossupload, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//获取作品数量
export const asyncgetsharecount = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsharecount, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//创建秘密文件
export const asynccreatesecretfile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createsecretfile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//修改秘密文件
export const asyncupdatesecretfile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatesecretfile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//删除秘密文件
export const asyncdelsecretfile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delsecretfile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//获取秘密文件
export const asyncgetsecretfile = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getsecretfile, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

//创建/删除课程包课程
export const asynccreatecoursecatebag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createcoursecatebag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询所有课程包课程
export const asyncgetcoursecatebag = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getcoursecatebag, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建教师资料
export const asynccreateteacherproposal = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createteacherproposal, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改教师资料
export const asyncupdateteacherproposal = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateteacherproposal, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除教师资料
export const asyncdelteacherproposal = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delteacherproposal, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 添加教师上课资料
export const asynccreatetpdata = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createtpdata, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改教师上课资料
export const asyncupdatetpdata = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatetpdata, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除教师上课资料
export const asyncdeltpdata = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deltpdata, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询所有课程包课程
export const asyncgetteacherproposal = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getteacherproposal, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询所有课程包课程
export const asyncgettpdata = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettpdata, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询所有问题
export const asyncgetitembank = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getitembank, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建问题
export const asynccreateitembank = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createitembank, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改问题
export const asyncupdateitembank = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateitembank, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除问题
export const asyncdelitembank = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delitembank, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}


// 查询所有问题
export const asyncgetitembankgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getitembankgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 查询所有问题
export const asyncgetteacheritembank = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getteacheritembank, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncgetteacheritembanks = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getteacheritembanks, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建问题
export const asynccreateitembankgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createitembankgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 修改问题
export const asyncupdateitembankgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateitembankgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 删除问题
export const asyncdelitembankgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delitembankgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 获取
export const asyncgetitembankitembankgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getitembankitembankgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建修改
export const asynccreateitembankitembankgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createitembankitembankgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

// 创建口令组
export const asynccreatepasswordgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createpasswordgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 获取所有口令组
export const asyncgetpasswordgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getpasswordgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 更改口令组
export const asyncupdatepasswordgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatepasswordgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 获取口令组下面的课程
export const asyncgetcoursepasswordgroupbygroupid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getcoursepasswordgroupbygroupid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 创建/修改口令组课程
export const asynccreatecoursepasswordgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createcoursepasswordgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 生成序列号
export const asynccreatepassword = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createpassword, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 删除口令组课程
export const asyncdeletecoursepasswordgroup = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deletecoursepasswordgroup, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 获取序列号
export const asyncgetpasswordbygroupid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getpasswordbygroupid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 上传新用户信息
export const asyncbindwechatpasswold = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.asyncbindwechatpasswold, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
// 修改个人信息
export const update = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.update, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//创建用户和dpdata表
export const asynccreateusertotpdata = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createusertotpdata, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//获取usertoypdata。id的数据
export const asyncselectallusertotpdataid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectallusertotpdataid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//删除usertoypdata。id的数据
export const asyncdelctallusertotpdataid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delctallusertotpdataid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncupdatepasswordid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatepasswordid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncanswer = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.answer, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//发送短信
export const asyncmessagename = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.messagename, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//创建备注
export const asynccreateremaproposal = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createremaproposal, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
//根据ID获取数据
export const asyncgetanswerinremap = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getanswerinremap, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncgetallswerinremap = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getallswerinremap, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncgetlogs = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getlogs, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncossupload8 = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.ossupload8, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncInquireusertotpdataid9 = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.Inquireusertotpdataid9, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}
export const asyncselectallusertotpdataidd = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.selectallusertotpdataidd, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetvideoanswers = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getvideoanswers, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreatevideoanswers = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createvideoanswers, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncGetCategories = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.GetCategories, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncUpdateCategory = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.UpdateCategory, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncGetVideoPlayAuth = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.GetVideoPlayAuth, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncget_all_private_template = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.get_all_private_template, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncmessagesend = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.messagesend, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetweixinusers = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getweixinusers, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreatetags = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.createtags, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgettags = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettags, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncupdatetags = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updatetags, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncdeletetags = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.deletetags, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncbatchtagging = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.batchtagging, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgettaguser = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.gettaguser, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncbatchuntagging = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.batchuntagging, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncbatchget = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.batchget, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncupdateremark = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updateremark, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncfindallschool = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.findallschool, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asynccreatschool = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.creatschool, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncupdataschool = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.updataschool, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncdelschool = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.delschool, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetschooluserbysid = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getschooluserbysid, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncgetschoolpackegekey = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.getschoolpackegekey, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}

export const asyncaddschoolpackegekey = function (data) {
  return new Promise((resolve, reject) => {
    post(interfaces.addschoolpackegekey, data).then(response => {
      if (response.error == 0) {
        resolve(response.data)
      } else {
        reject(response.msg)
      }
    }).catch(function (error) {
      console.log(error);
      reject('服务器开小差了')
    })
  })
}